package com.amin.app.web.service;

import com.amin.app.web.entity.SMenu;
import com.amin.app.web.entity.SUsers;
import com.amin.app.web.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService implements UserDetailsService {
    final
    UserMapper userMapper;

    public UserService(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public void save(SUsers sUsers) {
        userMapper.save(sUsers);
    }

    public SUsers getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    public void update(SUsers sUsers) {
        userMapper.update(sUsers);
    }

    public void delById(Integer id) {
        userMapper.delById(id);
    }

    public List<SUsers> getUserList(SUsers sUsers) {
        return userMapper.getUserList(sUsers);
    }


    public SUsers loadUserByUsername(String username) {
        return   userMapper.getUserInfoByUserName(username);
    }

    public SUsers getUserInfoByUserName(String username) {
        return   userMapper.getUserInfoByUserName(username);
    }
}
